
<?php
    // variables par defaut pour le login
    $message = "";
    $formAction = $this->baseUrl('login/signin');
    $title = $this->translate('login_title_signin');
    $divPublicName = "";
    $divPass = "<div class='form-item'>
        <label>" . $this->translate('login_pass') . "</label>
        <input type='password' name='password'/>
    </div>";
    $buttonValidate = $this->translate('login_signin');
    $sub_infos = "";

    if (isset($_GET['a'])) {
        if ($_GET['a'] == 'sub') {

            $sub_infos .= '<div class="warning-container">';
            $sub_infos .= '<div class="warning">';
            $sub_infos .= '<img src="/mediaglobe/images/icons/warning.png"/>';
            $sub_infos .= 'Seul le pseudo est visible par les autres utilisateurs';
            $sub_infos .= '</div>';
            $sub_infos .= '</div>';

            $formAction = $this->baseUrl('login/subscribe');
            $title = $this->translate('login_title_subscribe');
            $divPublicName = "<div class='form-item'>
                <label>" . $this->translate('login_publicName') . "</label>
                <input type='text' name='publicName'/>
            </div>";
            $buttonValidate = $this->translate("login_subscribe");
        }
        else if ($_GET['a'] == 'lost') {
            $formAction = $this->baseUrl('login/lostPass');
            $title = $this->translate('login_title_lostPass');
            $divPass = "";
            $buttonValidate = $this->translate("login_sendNewPass");
        }
    }

    if (isset($_GET['result'])) {
        if ($_GET['result'] == 'sub' && isset($_GET['value'])) {
            $message = "L'utilisateur " . $_GET['value'] . " a bien été créé.<br/>Un mail vous a été envoyé pour confirmé l'inscription";
        }
    }
?>


<!-- Formulaire (complété dynamiquement ci-dessus) -->
<div class="form-container">
    <?php echo $message; ?>
    <h1><?php echo $title ?></h1>
    <?php echo $sub_infos; ?>
    <form action="<?php echo $formAction ?>" method="post">
        <label><?php echo $divPublicName ?></label>
        <div class="form-item">
            <label><?php echo $this->translate('login_email') ?></label>
            <input type="text" name="email" /><br />
        </div>
        <label><?php echo $divPass ?></label>
        <div class="form-submit">
            <input type="submit"  value="<?php echo $buttonValidate ?>" />
        </div>
    </form>
</div>


<!-- Boutons permettant de changer le formulaire -->
<div class='horizontal' style="padding: 10px;">
<!--     <a class='button' href="< ?php echo $this->baseUrl('login/passForgotten'); ?>"> < ?php echo $this->translate('login_forgotten') ?></a> -->
    <div class='button' onclick="location.href='index?a=lost'">
        <img src='/mediaglobe/images/icon_register.png'/>
        <?php echo $this->translate('login_forgotten') ?>
    </div>
    <div class='button' onclick="location.href='index?a=sub'">
        <img src='/mediaglobe/images/icon_register.png'/>
        <?php echo $this->translate('login_subscribe') ?>
    </div>
</div>


<!-- tests
<br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/>
<div class="warning">
    <img src="/mediaglobe/images/icons/warning.png"/>
    test
</div>
<div class="error">
    <img src="/mediaglobe/images/icons/error.png"/>
    test
</div>-->



<!-- <a class='button' href="< ?php echo $this->baseUrl('login/subscribe'); ?>">test</a> -->

